Skip to content

Conversation

@Sachaa-Thanasius
Copy link
Contributor

@Sachaa-Thanasius Sachaa-Thanasius commented Dec 28, 2025

As far as I know (and based on the information in the linked issue), this statement in the docs hasn't been true since at least Python 2.7.


📚 Documentation preview 📚: https://cpython-previews--143261.org.readthedocs.build/

The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think.

This was likely missed in python#69686.
@aisk aisk added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 29, 2025
Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot, thank you!

@hauntsaninja hauntsaninja merged commit 79c03ac into python:main Dec 30, 2025
47 checks passed
@miss-islington-app
Copy link

Thanks @Sachaa-Thanasius for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Dec 30, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 30, 2025
…ythonGH-143261)

Remove untrue part of `__import__` replacement docs

The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think.

This was likely missed in python#69686.
(cherry picked from commit 79c03ac)

Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 30, 2025
…ythonGH-143261)

Remove untrue part of `__import__` replacement docs

The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think.

This was likely missed in python#69686.
(cherry picked from commit 79c03ac)

Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Dec 30, 2025

GH-143281 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Dec 30, 2025
@bedevere-app
Copy link

bedevere-app bot commented Dec 30, 2025

GH-143282 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Dec 30, 2025
hauntsaninja pushed a commit that referenced this pull request Dec 30, 2025
…H-143261) (#143281)

gh-69686: Remove untrue part of `__import__` replacement docs (GH-143261)

Remove untrue part of `__import__` replacement docs

The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think.

This was likely missed in #69686.
(cherry picked from commit 79c03ac)

Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
hauntsaninja pushed a commit that referenced this pull request Dec 30, 2025
…H-143261) (#143282)

gh-69686: Remove untrue part of `__import__` replacement docs (GH-143261)

Remove untrue part of `__import__` replacement docs

The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think.

This was likely missed in #69686.
(cherry picked from commit 79c03ac)

Co-authored-by: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants